// 测试游戏界面中的颜色分配
console.log('🎮 测试游戏界面颜色分配...')

// 获取游戏状态
const gameStore = window.__VUE_APP__._instance.provides.gameStore

if (gameStore) {
  console.log('✅ 找到游戏 Store')
  
  const players = gameStore.players || []
  const currentPlayer = gameStore.currentPlayer
  
  console.log('当前玩家:', currentPlayer)
  console.log('玩家列表:', players)
  
  if (players.length > 0) {
    console.log('\n=== 游戏界面颜色分配 ===')
    
    players.forEach((player, index) => {
      console.log(`${index + 1}. ${player.nickname} (${player.isOwner ? '房主' : '玩家'})`)
      console.log(`   头像颜色: ${player.avatarColor}`)
      console.log(`   画笔颜色: ${player.brushColor}`)
      console.log(`   兼容颜色: ${player.color}`)
    })
    
    // 检查颜色一致性
    const hasAvatarColors = players.every(p => p.avatarColor)
    const hasBrushColors = players.every(p => p.brushColor)
    const hasCompatibleColors = players.every(p => p.color)
    
    console.log('\n=== 颜色一致性检查 ===')
    console.log(`所有玩家都有头像颜色: ${hasAvatarColors ? '✅' : '❌'}`)
    console.log(`所有玩家都有画笔颜色: ${hasBrushColors ? '✅' : '❌'}`)
    console.log(`所有玩家都有兼容颜色: ${hasCompatibleColors ? '✅' : '❌'}`)
    
    // 检查画笔颜色唯一性
    const brushColors = players.map(p => p.brushColor).filter(c => c)
    const uniqueBrushColors = new Set(brushColors)
    
    console.log(`\n画笔颜色唯一性: ${brushColors.length === uniqueBrushColors.size ? '✅' : '❌'}`)
    console.log(`总玩家: ${players.length}, 画笔颜色: ${brushColors.length}, 唯一颜色: ${uniqueBrushColors.size}`)
    
    if (brushColors.length !== uniqueBrushColors.size) {
      console.log('❌ 有重复的画笔颜色:', brushColors)
    }
    
    // 检查当前玩家的画笔颜色
    if (currentPlayer) {
      console.log('\n=== 当前玩家画笔颜色 ===')
      console.log(`昵称: ${currentPlayer.nickname}`)
      console.log(`画笔颜色: ${currentPlayer.brushColor}`)
      console.log(`是否在画布中使用: ${currentPlayer.brushColor ? '应该使用' : '可能未设置'}`)
    }
    
  } else {
    console.log('❌ 没有玩家')
  }
} else {
  console.log('❌ 找不到游戏 Store')
}

console.log('\n测试完成')
